/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package p1;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Derek Ward
 * 
 * A simple unit test for a ProblemFile object
 * 
 */
public class ProblemFileUnitTest 
{
    private     ProblemFile     pf;
    private     String          fileName;
    private     Graph           graph;
    
    
    public ProblemFileUnitTest(String s, DataFile df)
    {
        fileName = s;
        
        try {
            graph = new Graph(df);
        } catch (IOException ex) {
            System.err.println(ex.getMessage());
            System.exit(1);
        } catch (InvalidEdgeWeightException ex) {
            System.err.println(ex.getMessage());
            System.exit(1);
        }
    }
    
    public void execute()
    {
        pf = new ProblemFile(graph, fileName);
        
        try 
        {
            pf.readProblemFile();
        } 
        catch (IOException ex) 
        {
            System.err.println(ex.getMessage());
            System.err.println(ex.getStackTrace());
            System.exit(1);
        } 
        catch (InvalidProblemException ex) 
        {
            System.err.println(ex.getMessage());
            System.err.println(ex.getStackTrace());
            System.exit(1);
        }
        
        
    }
}
